#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //设置最大最小值
    ui->horizontalSlider->setMaximum(100);
    ui->horizontalSlider->setMinimum(0);
    //设置当前初始值
    //ui->horizontalSlider->setValue(20);
    //设置一步走多长
    ui->horizontalSlider->setSingleStep(10);


    //设置最大最小值
    ui->verticalSlider->setMaximum(100);
    ui->verticalSlider->setMinimum(0);
    //设置当前初始值
    //`ui->verticalSlider->setValue(20);
    //设置一步走多长
    ui->verticalSlider->setSingleStep(10);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_horizontalSlider_valueChanged(int value)
{
    QRect rect = geometry();
    setGeometry(rect.x(), rect.y(), value, rect.height());
}

void Widget::on_verticalSlider_valueChanged(int value)
{
    QRect rect = geometry();
    setGeometry(rect.x(), rect.y(),rect.width() , value);
}
